import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { UserModule } from './user/user.module';
import { CaptchaModule } from './captcha/captcha.module';

//配置mongodb 
import { MongooseModule } from '@nestjs/mongoose';

//配置jwt模块
import { AuthModule } from './auth/auth.module';
import { UploadFileModule } from './upload-file/upload-file.module';

//配置静态资源访问
import { ServeStaticModule } from '@nestjs/serve-static';
import { join } from 'path';
import { DownloadFileModule } from './download-file/download-file.module';
import { VideoModule } from './video/video.module';
import { CacheModule } from './cache/cache.module';

@Module({
  imports: [
    ServeStaticModule.forRoot({
      rootPath: join(__dirname, '..', 'dist', 'uploads'), // 指定静态资源文件夹的路径
      serveRoot: '/uploads', // 指定访问静态资源的前缀路径
    }),
    UserModule,
    CaptchaModule,
    MongooseModule.forRoot('mongodb://localhost:27017/nest-video'),
    AuthModule,
    UploadFileModule, 
    DownloadFileModule, 
    VideoModule, 
    CacheModule

  ],
  controllers: [AppController],
  providers: [AppService],
})
export class AppModule { }
